<!DOCTYPE html>
<html>
<head>
	<title>修改子账号</title>
	<include file='public/head'>
	<style>
		.layui-legend-size{font-size:14px !important;}
		.layui-nopadding{padding:0 !important;}
		.layui-overflow{overflow:auto;}
		.layui-nomargin{margin: 0 !important;}
		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
		.layui-input{height:30px !important; }
		.layui-form-search-item .layui-inline{margin-bottom: 5px;} 
		.layui-form-search-item label{margin-left: 15px;}
		.layui-table-page {padding: 7px 0px 0px;}
		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
	</style>		
</head>
<body>
<!-- layui-tab开始 -->
<div class="layui-tab " lay-filter="demo-tab">
	<div class="layui-card">
		<div class="layui-card-body layui-nopadding " >
			<form id="f" class="layui-form">
				<table  class="layui-table layui-nomargin" >
					<tr>
						<td>用户名</td>
						<td>
							{$info.user_login}
						</td>
					</tr>
					<tr>
						<td>原密码</td>
						<td>
							<input type="password" class="layui-input" id="old_pass" name="old_pass" value="" placeholder="请输入原密码">
						</td>
					</tr>
					<tr>
						<td>新密码</td>
						<td>
							<input type="password" class="layui-input" id="new_pass" name="new_pass" value="" placeholder="请输入新密码">
						</td>
					</tr>
					<tr>
						<td>确认密码</td>
						<td>
							<input type="password" class="layui-input" id="re_pass" name="re_pass" value="" placeholder="请再次输入新密码">
						</td>
					</tr>				
				</table>
			</form>
		</div>
	</div>
</div>

	<include file='public/scripts'>
<script type="text/javascript">

	function tijiao(){
		if($('#user_name').val() == ''){
			layer.msg('账号不能为空');
			return false;
		}

		if($('#old_pass').val() == ''){
			layer.msg('原密码不能为空');
			return false;
		}

		if($('#new_pass').val() == ''){
			layer.msg('新密码不能为空');
			return false;
		}		

		if($('#re_pass').val() == ''){
			layer.msg('重复密码不能为空');
			return false;
		}				

		if($('#new_pass').val() != $('#re_pass').val()){
			layer.msg('两次输入的密码不相同');
			return false;
		}
		data = {};
		data['user_name'] = $('#user_name').val();
		data['old_pass'] = $('#old_pass').val();
		data['new_pass'] = $('#new_pass').val();
		data['id'] = {$info.id};
		//提交
		$.ajax({
			url:"{:cmf_plugin_url('Store://admin_index/edituser')}",
			data: data,
			type:'post',
			success:function(data){
				if (data.code == 1) {
					layer.msg(data.msg,{icon:1,time:1500},function(){
						parent.layer.closeAll();
						parent.location.reload(); 
					});
				} else {
					layer.msg(data.msg,{icon:2,time:1500});
				}
			},
			error:function()
			{
				layer.msg('系统错误',{icon:2,time:1500});
			}
		})
	}

</script>
</body>
</html>	